<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>JS阻塞渲染进程</title>
	</head>
	<body>
		<h1>Mr.Yuan is awesome!</h1><button>change</button>
		<script>
			var h1 = document.querySelector('h1');
			var btn = document.querySelector('button');
			// 死循环指定的时间
			function delay(duration) {
				var start = Date.now();
				while (Date.now() - start < duration) {}
			}
			btn.onclick = function() {
				h1.textContent = '袁老师很帅!';
				delay(3000);
			};
		</script>
	</body>
</html>
